#include<iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int c1 = 0, c2 = 0;
    for (int i = 1; i <= 3; i++)
    {
        int x; cin >> x;
        if (x) c2++;
        else c1++;
    }
    char c;
    if (a > b && c1) c = 'a';
    else if (a < b && c1 == 3) c = 'a';
    else c = 'b';


    cout << "The winner is " << c << ": " << 
    (c == 'a' ? a : b) << " + " << 
    (c == 'a' ? c1 : c2) << endl;
    return 0;
}